<script type="text/javascript">
    RED.nodes.registerType('azure-event-hub-receive', {
        category: 'input',
        color: '#0080FF',
        defaults: {
            name: { value: "" },
            connectionstring: { value: "" },
            consumergroup: { value: "$default" }
        },
        inputs: 0,
        outputs: 1,
        icon: "icon.png",
        label: function () {
            return this.name || "azure-event-hub-receive";
        }
    });
</script>

<script type="text/x-red" data-template-name="azure-event-hub-receive">
    <div class="form-row">
        <label for="node-input-name"><i class="icon-tag"></i> Name</label>
        <input type="text" id="node-input-name" placeholder="Name">
    </div>
    <div class="form-row">
        <label for="node-input-connectionstring"><i class="icon-tag"></i> Event Hub Connection String</label>
        <input type="text" id="node-input-connectionstring" placeholder="E.g. Endpoint=sb://XXX.servicebus.windows.net/;SharedAccessKeyName=XXX;SharedAccessKey=XXX;EntityPath=XXX">
    </div>
    <div class="form-row">
        <label for="node-input-consumergroup"><i class="icon-tag"></i> Event Hub Consumer Group</label>
        <input type="text" id="node-input-consumergroup" placeholder="E.g. $default">
    </div>
</script>

<script type="text/x-red" data-help-name="azure-event-hub-receive">
    <p>A simple node that receives messages from an Azure Event Hub...</p>
    <h3>Inputs</h3>
    <dl class="message-properties">
        There are no inputs.
    </dl>

    <h3>Outputs</h3>
    <ol class="node-ports">
        <li>Standard output
            <dl class="message-properties">
                <dt>payload <span class="property-type">object</span></dt>
                <dd>A JSON object, received from the Event Hub.</dd>
            </dl>
        </li>
    </ol>
    
    <h3>Details</h3>
    In the node's properties, the connection string of the Event Hub to which
    you would like to connect, can be specified. Additionally the Consumer Group
    can be set in the properties as well. Both values can be retreived from 
    the Azure Portal.

    <h3>References</h3>
    <ul>
        <li><a href="https://azure.microsoft.com/en-us/services/event-hubs/">Azure Event Hubs</a></li>
        <li><a https://github.com/azure/azure-event-hubs-node>Azure Event Hubs NodeJS client (in preview)</a> - the client library used by this node</li>
    </ul>
</script>
</script>